home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / dcopypm6.arj / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1993-10-30  |  2KB  |  80 lines

  1. /* INSTALL origin Bernd Wetzel 1993                                          */
  2. /* procedure to install Dcopy on the harddisk                                */
  3. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4. CALL SysLoadFuncs 
  5.  
  6. title = 'Installation of DCopy'
  7. sourcepath = 'A:\DCOPY'
  8. targetpath = 'C:\OS2\APPS'
  9. file.0 = 4
  10. file.1 = 'DCOPY.EXE'
  11. file.2 = 'DCOPY.TIC'
  12. file.3 = 'DCOPY.CNF'
  13. file.4 = 'DCOPY.DOC'
  14.  
  15. CALL SysCls
  16. SAY 
  17. SAY ''title''
  18. SAY 'By default DCopy will be installed to' targetpath'.'
  19. SAY 'Enter "Y" to confirm, "N" to exit or enter a new path (e.g. C:\DCOPY)'
  20. SAY 'where DCopy should be installed.'
  21. SAY 'Press <ENTER> when ready.'
  22. PULL answer .
  23. IF (answer <> 'Y') THEN DO
  24.   IF (answer = 'N') THEN EXIT 1
  25.   targetpath = answer
  26. END
  27.  
  28. '@CD' sourcepath
  29. IF (rc <> 0) THEN DO
  30.    SAY 'DCopy could not be found in' sourcepath '!'
  31.    SAY title 'will be terminated.'
  32.    EXIT 2
  33. END
  34.  
  35. /* Check for all the files in the current directory                           */
  36. filemissing = 0
  37. DO i = 1 TO file.0
  38.   search = file.i
  39.   sysrc = SysFileTree(search, ret, 'FO')
  40.   IF (ret.0 = 0 | sysrc <> 0) THEN DO
  41.     SAY file.i 'is missing in the current directory'
  42.     filemissing = 1
  43.   END
  44. END
  45. IF filemissing = 1 THEN DO
  46.   EXIT 1
  47. END
  48.  
  49. sysrc = SysMkDir(targetpath)
  50. IF (sysrc <> 0) THEN DO
  51.   SAY 'Directory' targetpath 'could not be created !'
  52.   IF (sysrc = 5) THEN SAY 'Directory already exists !'
  53.   SAY 'Enter "Y" to confirm, "N" to exit'
  54.   SAY 'Press <ENTER> when ready.'
  55.   PULL answer .
  56.   IF (answer <> 'Y') THEN EXIT 2
  57. END
  58.  
  59. SAY 'DCopy will be installed to 'targetpath' ...'
  60. DO i = 1 TO file.0
  61.   target = targetpath || '\' || file.i
  62.   '@COPY' file.i '/B' target '/V >nul 2>nul'
  63.   IF (rc <> 0) THEN DO
  64.     SAY 'File' file.i 'could not be copied to' targetpath '!'
  65.     SAY title 'will be terminated.'
  66.     EXIT 3
  67.   END
  68. END
  69.  
  70. SAY 'DCopy will be created as object on the desktop ...'
  71. sysrc = SysCreateObject('WPProgram','DCopy','<WP_DESKTOP>','EXENAME='|| targetpath || '\' || file.1';PROGTYPE=PM;STARTUPDIR='||targetpath)
  72. IF (sysrc <> 1) THEN DO
  73.   SAY 'Object could not be created on the desktop !'
  74.   SAY title 'will be terminated.'
  75.   EXIT 4
  76. END
  77.  
  78. SAY 'DCopy was successfully installed to 'targetpath'.'
  79. EXIT 0
  80.